package dfbz.demo02;
public class Person {
    private String name;//名字
    private int age; //年龄
    private String sex;//性别

    public void eat(){
        System.out.println("我具有吃的功能");
    }
    public void sleep(){
        System.out.println("我具有吃的功能");
    }
    public String setName(String name){
           this.name=name;
           return name;
    }
    public String getName(){
        return name;
    }
    public void setAge(int age){
        if(age<=0&&age>100){
            System.out.println("年龄有误");
        }else {
            this.age=age;
        }
    }
    public void setSex(String sex){
        this.sex=sex;
    }
    public String getSex(){
        return sex;
    }
}
